package cx.ath.skyflyer.chart;

/**
 *
 * @author Ahti Legonkov
 */
public class Rectangle {

    public Rectangle(int top, int left, int bottom, int right) {
        this.top = top;
        this.left = left;
        this.bottom = bottom;
        this.right = right;
    }

    int width() {
        return right - left;
    }

    int height() {
        return bottom - top;
    }

    Rectangle in(Margins m) {
        return new Rectangle(top+m.top, left+m.left, bottom-m.bottom, right-m.right);
    }

    Rectangle out(Margins m) {
        return new Rectangle(top-m.top, left-m.left, bottom+m.bottom, right+m.right);
    }

    public final int top;
    public final int left;
    public final int bottom;
    public final int right;
}
